package lily.phs.diabet;

import lily.phs.database.Constants;
import lily.phs.object.DiabetService;
import lily.phs.object.HereTipa;
import lily.phs.urh.R;
import lily.ui.control.MyPopupWindow;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;

public class DiabetServiceView_1 extends LinearLayout implements Constants,
		OnClickListener, OnFocusChangeListener {

	private Context mContext;
	private EditText et_name,et_id,et_date_1,et_date_2,et_date_3,et_date_4,et_symptoms_1,et_symptoms_2,et_symptoms_3,et_symptoms_4,
	et_symptom_other_1,et_symptom_other_2,et_symptom_other_3,et_symptom_other_4,et_blood_pressure_high_1,et_blood_pressure_high_2,
	et_blood_pressure_high_3,et_blood_pressure_high_4,et_blood_pressure_low_1,et_blood_pressure_low_2,et_blood_pressure_low_3,
	et_blood_pressure_low_4,et_weight_now_1,et_weight_now_2,et_weight_now_3,et_weight_now_4,et_weight_goal_1,et_weight_goal_2,
	et_weight_goal_3,et_weight_goal_4,et_bmt_now_1,et_bmt_now_2,et_bmt_now_3,et_bmt_now_4,et_bmt_goal_1,et_bmt_goal_2,
	et_bmt_goal_3,et_bmt_goal_4,et_physical_sign_other_1,et_physical_sign_other_2,et_physical_sign_other_3,
	et_physical_sign_other_4,et_smoke_now_1,et_smoke_now_2,et_smoke_now_3,et_smoke_now_4,et_smoke_goal_1,et_smoke_goal_2,
	et_smoke_goal_3,et_smoke_goal_4,et_drink_now_1,et_drink_now_2,et_drink_now_3,et_drink_now_4,et_drink_goal_1,et_drink_goal_2,
	et_drink_goal_3,et_drink_goal_4,et_exe_per_week_now_1,et_exe_per_week_now_2,et_exe_per_week_now_3,et_exe_per_week_now_4,
	et_exe_per_week_goal_1,et_exe_per_week_goal_2,et_exe_per_week_goal_3,et_exe_per_week_goal_4,et_exe_lastlong_now_1,
	et_exe_lastlong_now_2,et_exe_lastlong_now_3,et_exe_lastlong_now_4,et_exe_lastlong_goal_1,et_exe_lastlong_goal_2,
	et_exe_lastlong_goal_3,et_exe_lastlong_goal_4,et_diet_now_1,et_diet_now_2,et_diet_now_3,et_diet_now_4,et_diet_goal_1,
	et_diet_goal_2,et_diet_goal_3,et_diet_goal_4;
	
	private RadioGroup rg_service_pattern_1,rg_service_pattern_2,rg_service_pattern_3,rg_service_pattern_4,rg_dap_1,rg_dap_2,
	rg_dap_3,rg_dap_4,rg_mentality_1,rg_mentality_2,rg_mentality_3,rg_mentality_4,rg_comply_1,rg_comply_2,rg_comply_3,rg_comply_4;
	
	private RadioButton rb_service_pattern_1_1,rb_service_pattern_1_2,rb_service_pattern_1_3,rb_service_pattern_2_1,
	rb_service_pattern_2_2,rb_service_pattern_2_3,rb_service_pattern_3_1,rb_service_pattern_3_2,rb_service_pattern_3_3,
	rb_service_pattern_4_1,rb_service_pattern_4_2,rb_service_pattern_4_3,rb_dap_1_1,rb_dap_1_2,rb_dap_2_1,rb_dap_2_2,rb_dap_3_1,
	rb_dap_3_2,rb_dap_4_1,rb_dap_4_2,rb_mentality_1_1,rb_mentality_1_2,rb_mentality_1_3,rb_mentality_2_1,rb_mentality_2_2,
	rb_mentality_2_3,rb_mentality_3_1,rb_mentality_3_2,rb_mentality_3_3,rb_mentality_4_1,rb_mentality_4_2,rb_mentality_4_3,
	rb_comply_1_1,rb_comply_1_2,rb_comply_1_3,rb_comply_2_1,rb_comply_2_2,rb_comply_2_3,rb_comply_3_1,rb_comply_3_2,
	rb_comply_3_3,rb_comply_4_1,rb_comply_4_2,rb_comply_4_3;
	
	private MyPopupWindow mPopupWindow;
	
	private HereTipa ht;
	private DiabetService diabet1,diabet2,diabet3,diabet4;
	private View child;
	private int profileId = 0;
	
	public DiabetServiceView_1(Context context,int profileid) {
		super(context);
		// TODO Auto-generated constructor stub
		this.mContext = context;
		this.profileId = profileid;
		
		final LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		child = inflater.inflate(R.layout.diabet_service_1, null);
		
		//这是第一个页面，在主线程中加载，但数据处理可放在次线程中
		findViewsById();
		setMyView();
		
	}
	
	/**
	 * 控件与xml文件关联
	 */
	public void findViewsById() {
		et_name = (EditText)child.findViewById(R.id.pre_name);
		et_id = (EditText)child.findViewById(R.id.pre_id);
		et_date_1 = (EditText)child.findViewById(R.id.date_1);
		et_date_2 = (EditText)child.findViewById(R.id.date_2);
		et_date_3 = (EditText)child.findViewById(R.id.date_3);
		et_date_4 = (EditText)child.findViewById(R.id.date_4);
		et_symptoms_1 = (EditText)child.findViewById(R.id.symptoms_1);
		et_symptoms_1.setOnClickListener(this);
		et_symptoms_1.setOnFocusChangeListener(this);
		et_symptoms_2 = (EditText)child.findViewById(R.id.symptoms_2);
		et_symptoms_2.setOnClickListener(this);
		et_symptoms_2.setOnFocusChangeListener(this);
		et_symptoms_3 = (EditText)child.findViewById(R.id.symptoms_3);
		et_symptoms_3.setOnClickListener(this);
		et_symptoms_3.setOnFocusChangeListener(this);
		et_symptoms_4 = (EditText)child.findViewById(R.id.symptoms_4);
		et_symptoms_4.setOnClickListener(this);
		et_symptoms_4.setOnFocusChangeListener(this);
		et_symptom_other_1 = (EditText)child.findViewById(R.id.symptom_other_1);
		et_symptom_other_2 = (EditText)child.findViewById(R.id.symptom_other_2);
		et_symptom_other_3 = (EditText)child.findViewById(R.id.symptom_other_3);
		et_symptom_other_4 = (EditText)child.findViewById(R.id.symptom_other_4);
		et_blood_pressure_high_1 = (EditText)child.findViewById(R.id.blood_pressure_high_1);
		et_blood_pressure_high_2 = (EditText)child.findViewById(R.id.blood_pressure_high_2);
		et_blood_pressure_high_3 = (EditText)child.findViewById(R.id.blood_pressure_high_3);
		et_blood_pressure_high_4 = (EditText)child.findViewById(R.id.blood_pressure_high_4);
		et_blood_pressure_low_1 = (EditText)child.findViewById(R.id.blood_pressure_low_1);
		et_blood_pressure_low_2 = (EditText)child.findViewById(R.id.blood_pressure_low_2);
		et_blood_pressure_low_3 = (EditText)child.findViewById(R.id.blood_pressure_low_3);
		et_blood_pressure_low_4 = (EditText)child.findViewById(R.id.blood_pressure_low_4);
		et_weight_now_1 = (EditText)child.findViewById(R.id.weight_now_1);
		et_weight_now_2 = (EditText)child.findViewById(R.id.weight_now_2);
		et_weight_now_3 = (EditText)child.findViewById(R.id.weight_now_3);
		et_weight_now_4 = (EditText)child.findViewById(R.id.weight_now_4);
		et_weight_goal_1 = (EditText)child.findViewById(R.id.weight_goal_1);
		et_weight_goal_2 = (EditText)child.findViewById(R.id.weight_goal_2);
		et_weight_goal_3 = (EditText)child.findViewById(R.id.weight_goal_3);
		et_weight_goal_4 = (EditText)child.findViewById(R.id.weight_goal_4);
		et_bmt_now_1 = (EditText)child.findViewById(R.id.bmt_now_1);
		et_bmt_now_2 = (EditText)child.findViewById(R.id.bmt_now_2);
		et_bmt_now_3 = (EditText)child.findViewById(R.id.bmt_now_3);
		et_bmt_now_4 = (EditText)child.findViewById(R.id.bmt_now_4);
		et_bmt_goal_1 = (EditText)child.findViewById(R.id.bmt_goal_1);
		et_bmt_goal_2 = (EditText)child.findViewById(R.id.bmt_goal_2);
		et_bmt_goal_3 = (EditText)child.findViewById(R.id.bmt_goal_3);
		et_bmt_goal_4 = (EditText)child.findViewById(R.id.bmt_goal_4);
		et_physical_sign_other_1 = (EditText)child.findViewById(R.id.physical_sign_other_1);
		et_physical_sign_other_2 = (EditText)child.findViewById(R.id.physical_sign_other_2);
		et_physical_sign_other_3 = (EditText)child.findViewById(R.id.physical_sign_other_3);
		et_physical_sign_other_4 = (EditText)child.findViewById(R.id.physical_sign_other_4);
		et_smoke_now_1 = (EditText)child.findViewById(R.id.smoke_now_1);
		et_smoke_now_2 = (EditText)child.findViewById(R.id.smoke_now_2);
		et_smoke_now_3 = (EditText)child.findViewById(R.id.smoke_now_3);
		et_smoke_now_4 = (EditText)child.findViewById(R.id.smoke_now_4);
		et_smoke_goal_1 = (EditText)child.findViewById(R.id.smoke_goal_1);
		et_smoke_goal_2 = (EditText)child.findViewById(R.id.smoke_goal_2);
		et_smoke_goal_3 = (EditText)child.findViewById(R.id.smoke_goal_3);
		et_smoke_goal_4 = (EditText)child.findViewById(R.id.smoke_goal_4);
		et_drink_now_1 = (EditText)child.findViewById(R.id.drink_now_1);
		et_drink_now_2 = (EditText)child.findViewById(R.id.drink_now_2);
		et_drink_now_3 = (EditText)child.findViewById(R.id.drink_now_3);
		et_drink_now_4 = (EditText)child.findViewById(R.id.drink_now_4);
		et_drink_goal_1 = (EditText)child.findViewById(R.id.drink_goal_1);
		et_drink_goal_2 = (EditText)child.findViewById(R.id.drink_goal_2);
		et_drink_goal_3 = (EditText)child.findViewById(R.id.drink_goal_3);
		et_drink_goal_4 = (EditText)child.findViewById(R.id.drink_goal_4);
		et_exe_per_week_now_1 = (EditText)child.findViewById(R.id.exe_per_week_now_1);
		et_exe_per_week_now_2 = (EditText)child.findViewById(R.id.exe_per_week_now_2);
		et_exe_per_week_now_3 = (EditText)child.findViewById(R.id.exe_per_week_now_3);
		et_exe_per_week_now_4 = (EditText)child.findViewById(R.id.exe_per_week_now_4);
		et_exe_per_week_goal_1 = (EditText)child.findViewById(R.id.exe_per_week_goal_1);
		et_exe_per_week_goal_2 = (EditText)child.findViewById(R.id.exe_per_week_goal_2);
		et_exe_per_week_goal_3 = (EditText)child.findViewById(R.id.exe_per_week_goal_3);
		et_exe_per_week_goal_4 = (EditText)child.findViewById(R.id.exe_per_week_goal_4);
		et_exe_lastlong_now_1 = (EditText)child.findViewById(R.id.exe_lastlong_now_1);
		et_exe_lastlong_now_2 = (EditText)child.findViewById(R.id.exe_lastlong_now_2);
		et_exe_lastlong_now_3 = (EditText)child.findViewById(R.id.exe_lastlong_now_3);
		et_exe_lastlong_now_4 = (EditText)child.findViewById(R.id.exe_lastlong_now_4);
		et_exe_lastlong_goal_1 = (EditText)child.findViewById(R.id.exe_lastlong_goal_1);
		et_exe_lastlong_goal_2 = (EditText)child.findViewById(R.id.exe_lastlong_goal_2);
		et_exe_lastlong_goal_3 = (EditText)child.findViewById(R.id.exe_lastlong_goal_3);
		et_exe_lastlong_goal_4 = (EditText)child.findViewById(R.id.exe_lastlong_goal_4);
		et_diet_now_1 = (EditText)child.findViewById(R.id.diet_now_1);
		et_diet_now_2 = (EditText)child.findViewById(R.id.diet_now_2);
		et_diet_now_3 = (EditText)child.findViewById(R.id.diet_now_3);
		et_diet_now_4 = (EditText)child.findViewById(R.id.diet_now_4);
		et_diet_goal_1 = (EditText)child.findViewById(R.id.diet_goal_1);
		et_diet_goal_2 = (EditText)child.findViewById(R.id.diet_goal_2);
		et_diet_goal_3 = (EditText)child.findViewById(R.id.diet_goal_3);
		et_diet_goal_4 = (EditText)child.findViewById(R.id.diet_goal_4);
		rg_service_pattern_1 = (RadioGroup)child.findViewById(R.id.service_pattern_1);
		rg_service_pattern_2 = (RadioGroup)child.findViewById(R.id.service_pattern_2);
		rg_service_pattern_3 = (RadioGroup)child.findViewById(R.id.service_pattern_3);
		rg_service_pattern_4 = (RadioGroup)child.findViewById(R.id.service_pattern_4);
		rg_dap_1 = (RadioGroup)child.findViewById(R.id.dap_1);
		rg_dap_2 = (RadioGroup)child.findViewById(R.id.dap_2);
		rg_dap_3 = (RadioGroup)child.findViewById(R.id.dap_3);
		rg_dap_4 = (RadioGroup)child.findViewById(R.id.dap_4);
		rg_mentality_1 = (RadioGroup)child.findViewById(R.id.mentality_1);
		rg_mentality_2 = (RadioGroup)child.findViewById(R.id.mentality_2);
		rg_mentality_3 = (RadioGroup)child.findViewById(R.id.mentality_3);
		rg_mentality_4 = (RadioGroup)child.findViewById(R.id.mentality_4);
		rg_comply_1 = (RadioGroup)child.findViewById(R.id.comply_1);
		rg_comply_2 = (RadioGroup)child.findViewById(R.id.comply_2);
		rg_comply_3 = (RadioGroup)child.findViewById(R.id.comply_3);
		rg_comply_4 = (RadioGroup)child.findViewById(R.id.comply_4);
		rb_service_pattern_1_1 = (RadioButton)child.findViewById(R.id.service_pattern_1_1);
		rb_service_pattern_1_2 = (RadioButton)child.findViewById(R.id.service_pattern_1_2);
		rb_service_pattern_1_3 = (RadioButton)child.findViewById(R.id.service_pattern_1_3);
		rb_service_pattern_2_1 = (RadioButton)child.findViewById(R.id.service_pattern_2_1);
		rb_service_pattern_2_2 = (RadioButton)child.findViewById(R.id.service_pattern_2_2);
		rb_service_pattern_2_3 = (RadioButton)child.findViewById(R.id.service_pattern_2_3);
		rb_service_pattern_3_1 = (RadioButton)child.findViewById(R.id.service_pattern_3_1);
		rb_service_pattern_3_2 = (RadioButton)child.findViewById(R.id.service_pattern_3_2);
		rb_service_pattern_3_3 = (RadioButton)child.findViewById(R.id.service_pattern_3_3);
		rb_service_pattern_4_1 = (RadioButton)child.findViewById(R.id.service_pattern_4_1);
		rb_service_pattern_4_2 = (RadioButton)child.findViewById(R.id.service_pattern_4_2);
		rb_service_pattern_4_3 = (RadioButton)child.findViewById(R.id.service_pattern_4_3);
		rb_dap_1_1 = (RadioButton)child.findViewById(R.id.dap_1_1);
		rb_dap_1_2 = (RadioButton)child.findViewById(R.id.dap_1_2);
		rb_dap_2_1 = (RadioButton)child.findViewById(R.id.dap_2_1);
		rb_dap_2_2 = (RadioButton)child.findViewById(R.id.dap_2_2);
		rb_dap_3_1 = (RadioButton)child.findViewById(R.id.dap_3_1);
		rb_dap_3_2 = (RadioButton)child.findViewById(R.id.dap_3_2);
		rb_dap_4_1 = (RadioButton)child.findViewById(R.id.dap_4_1);
		rb_dap_4_2 = (RadioButton)child.findViewById(R.id.dap_4_2);
		rb_mentality_1_1 = (RadioButton)child.findViewById(R.id.mentality_1_1);
		rb_mentality_1_2 = (RadioButton)child.findViewById(R.id.mentality_1_2);
		rb_mentality_1_3 = (RadioButton)child.findViewById(R.id.mentality_1_3);
		rb_mentality_2_1 = (RadioButton)child.findViewById(R.id.mentality_2_1);
		rb_mentality_2_2 = (RadioButton)child.findViewById(R.id.mentality_2_2);
		rb_mentality_2_3 = (RadioButton)child.findViewById(R.id.mentality_2_3);
		rb_mentality_3_1 = (RadioButton)child.findViewById(R.id.mentality_3_1);
		rb_mentality_3_2 = (RadioButton)child.findViewById(R.id.mentality_3_2);
		rb_mentality_3_3 = (RadioButton)child.findViewById(R.id.mentality_3_3);
		rb_mentality_4_1 = (RadioButton)child.findViewById(R.id.mentality_4_1);
		rb_mentality_4_2 = (RadioButton)child.findViewById(R.id.mentality_4_2);
		rb_mentality_4_3 = (RadioButton)child.findViewById(R.id.mentality_4_3);
		rb_comply_1_1 = (RadioButton)child.findViewById(R.id.comply_1_1);
		rb_comply_1_2 = (RadioButton)child.findViewById(R.id.comply_1_2);
		rb_comply_1_3 = (RadioButton)child.findViewById(R.id.comply_1_3);
		rb_comply_2_1 = (RadioButton)child.findViewById(R.id.comply_2_1);
		rb_comply_2_2 = (RadioButton)child.findViewById(R.id.comply_2_2);
		rb_comply_2_3 = (RadioButton)child.findViewById(R.id.comply_2_3);
		rb_comply_3_1 = (RadioButton)child.findViewById(R.id.comply_3_1);
		rb_comply_3_2 = (RadioButton)child.findViewById(R.id.comply_3_2);
		rb_comply_3_3 = (RadioButton)child.findViewById(R.id.comply_3_3);
		rb_comply_4_1 = (RadioButton)child.findViewById(R.id.comply_4_1);
		rb_comply_4_2 = (RadioButton)child.findViewById(R.id.comply_4_2);
		rb_comply_4_3 = (RadioButton)child.findViewById(R.id.comply_4_3);
	
	}
	
	/**
	 * 初始化views
	 */
	public void initViews() {
		// TODO Auto-generated method stub
		initialState();
		
		String temp = "";
		int it = -1;
		float ft = -1f;
		
		temp = ht.getHeti_name();
		if(temp!=null){
			et_name.setText(temp);
		}
		temp = ht.getHeti_here_id();
		if(temp!=null){
			et_id.setText(temp);
		}
		et_name.setEnabled(false);
		et_id.setEnabled(false);
		
		//第一次随访记录
		temp = diabet1.getDise_date();
		if(temp.length()>0){
			et_date_1.setText(temp);
		}
		it = diabet1.getDise_service_pattern();
		switch(it){
		case 1:{
			rg_service_pattern_1.check(0);
			rb_service_pattern_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_service_pattern_1.check(1);
			rb_service_pattern_1_2.setChecked(true);
			break;
		}
		case 3:{
			rg_service_pattern_1.check(2);
			rb_service_pattern_1_3.setChecked(true);
			break;
		}
		}
		
		temp = diabet1.getDise_symptoms();
		if(temp.length()>0){
			et_symptoms_1.setText(temp);
		}
		temp = diabet1.getDise_symptom_other();
		if(temp.length()>0){
			et_symptom_other_1.setText(temp);
		}
		it = diabet1.getDise_blood_pressure_high();
		if(it!=-1){
			et_blood_pressure_high_1.setText(String.valueOf(it));
		}
		it = diabet1.getDise_blood_pressure_low();
		if(it!=-1){
			et_blood_pressure_low_1.setText(String.valueOf(it));
		}
		ft = diabet1.getDise_weight_now();
		if(ft!=-1f){
			et_weight_now_1.setText(String.valueOf(ft));
		}
		ft = diabet1.getDise_weight_goal();
		if(ft!=-1f){
			et_weight_goal_1.setText(String.valueOf(ft));
		}
		ft = diabet1.getDise_bmt_now();
		if(ft!=-1f){
			et_bmt_now_1.setText(String.valueOf(ft));
		}
		ft = diabet1.getDise_bmt_goal();
		if(ft!=-1f){
			et_bmt_goal_1.setText(String.valueOf(ft));
		}
		it = diabet1.getDise_dap();
		switch(it){
		case 1:{
			rg_dap_1.check(0);
			rb_dap_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_dap_1.check(1);
			rb_dap_1_2.setChecked(true);
			break;
		}
		}
		temp = diabet1.getDise_physical_sign_other();
		if(temp.length()>0){
			et_physical_sign_other_1.setText(temp);
		}
		it = diabet1.getDise_smoke_now();
		if(it!=-1){
			et_smoke_now_1.setText(String.valueOf(it));
		}
		it = diabet1.getDise_smoke_goal();
		if(it!=-1){
			et_smoke_goal_1.setText(String.valueOf(it));
		}
		ft = diabet1.getDise_drink_now();
		if(ft!=-1f){
			et_drink_now_1.setText(String.valueOf(ft));
		}
		ft = diabet1.getDise_drink_goal();
		if(ft!=-1f){
			et_drink_goal_1.setText(String.valueOf(ft));
		}
		it = diabet1.getDise_exe_per_week_now();
		if(it!=-1){
			et_exe_per_week_now_1.setText(String.valueOf(it));
		}
		it = diabet1.getDise_exe_per_week_goal();
		if(it!=-1){
			et_exe_per_week_goal_1.setText(String.valueOf(it));
		}
		it = diabet1.getDise_exe_lastlong_now();
		if(it!=-1){
			et_exe_lastlong_now_1.setText(String.valueOf(it));
		}
		it = diabet1.getDise_exe_lastlong_goal();
		if(it!=-1){
			et_exe_lastlong_goal_1.setText(String.valueOf(it));
		}
		ft = diabet1.getDise_diet_now();
		if(ft!=-1f){
			et_diet_now_1.setText(String.valueOf(ft));
		}
		ft = diabet1.getDise_diet_goal();
		if(ft!=-1f){
			et_diet_goal_1.setText(String.valueOf(ft));
		}
		it = diabet1.getDise_mentality();
		switch(it){
		case 1:{
			rg_mentality_1.check(0);
			rb_mentality_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_mentality_1.check(1);
			rb_mentality_1_2.setChecked(true);
			break;
		}
		case 3:{
			rg_mentality_1.check(2);
			rb_mentality_1_3.setChecked(true);
			break;
		}
		}
		it = diabet1.getDise_comply();
		switch(it){
		case 1:{
			rg_comply_1.check(0);
			rb_comply_1_1.setChecked(true);
			break;
		}
		case 2:{
			rg_comply_1.check(1);
			rb_comply_1_2.setChecked(true);
			break;
		}
		case 3:{
			rg_comply_1.check(2);
			rb_comply_1_3.setChecked(true);
			break;
		}
		}
		
		//第二次随访记录
		temp = diabet2.getDise_date();
		if(temp.length()>0){
			et_date_2.setText(temp);
		}
		it = diabet2.getDise_service_pattern();
		switch(it){
		case 1:{
			rg_service_pattern_2.check(0);
			rb_service_pattern_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_service_pattern_2.check(1);
			rb_service_pattern_2_2.setChecked(true);
			break;
		}
		case 3:{
			rg_service_pattern_2.check(2);
			rb_service_pattern_2_3.setChecked(true);
			break;
		}
		}
		
		temp = diabet2.getDise_symptoms();
		if(temp.length()>0){
			et_symptoms_2.setText(temp);
		}
		temp = diabet2.getDise_symptom_other();
		if(temp.length()>0){
			et_symptom_other_2.setText(temp);
		}
		it = diabet2.getDise_blood_pressure_high();
		if(it!=-1){
			et_blood_pressure_high_2.setText(String.valueOf(it));
		}
		it = diabet2.getDise_blood_pressure_low();
		if(it!=-1){
			et_blood_pressure_low_2.setText(String.valueOf(it));
		}
		ft = diabet2.getDise_weight_now();
		if(ft!=-1f){
			et_weight_now_2.setText(String.valueOf(ft));
		}
		ft = diabet2.getDise_weight_goal();
		if(ft!=-1f){
			et_weight_goal_2.setText(String.valueOf(ft));
		}
		ft = diabet2.getDise_bmt_now();
		if(ft!=-1f){
			et_bmt_now_2.setText(String.valueOf(ft));
		}
		ft = diabet2.getDise_bmt_goal();
		if(ft!=-1f){
			et_bmt_goal_2.setText(String.valueOf(ft));
		}
		it = diabet2.getDise_dap();
		switch(it){
		case 1:{
			rg_dap_2.check(0);
			rb_dap_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_dap_2.check(1);
			rb_dap_2_2.setChecked(true);
			break;
		}
		}
		temp = diabet2.getDise_physical_sign_other();
		if(temp.length()>0){
			et_physical_sign_other_2.setText(temp);
		}
		it = diabet2.getDise_smoke_now();
		if(it!=-1){
			et_smoke_now_2.setText(String.valueOf(it));
		}
		it = diabet2.getDise_smoke_goal();
		if(it!=-1){
			et_smoke_goal_2.setText(String.valueOf(it));
		}
		ft = diabet2.getDise_drink_now();
		if(ft!=-1f){
			et_drink_now_2.setText(String.valueOf(ft));
		}
		ft = diabet2.getDise_drink_goal();
		if(ft!=-1f){
			et_drink_goal_2.setText(String.valueOf(ft));
		}
		it = diabet2.getDise_exe_per_week_now();
		if(it!=-1){
			et_exe_per_week_now_2.setText(String.valueOf(it));
		}
		it = diabet2.getDise_exe_per_week_goal();
		if(it!=-1){
			et_exe_per_week_goal_2.setText(String.valueOf(it));
		}
		it = diabet2.getDise_exe_lastlong_now();
		if(it!=-1){
			et_exe_lastlong_now_2.setText(String.valueOf(it));
		}
		it = diabet2.getDise_exe_lastlong_goal();
		if(it!=-1){
			et_exe_lastlong_goal_2.setText(String.valueOf(it));
		}
		ft = diabet2.getDise_diet_now();
		if(ft!=-1f){
			et_diet_now_2.setText(String.valueOf(ft));
		}
		ft = diabet2.getDise_diet_goal();
		if(ft!=-1f){
			et_diet_goal_2.setText(String.valueOf(ft));
		}
		it = diabet2.getDise_mentality();
		switch(it){
		case 1:{
			rg_mentality_2.check(0);
			rb_mentality_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_mentality_2.check(1);
			rb_mentality_2_2.setChecked(true);
			break;
		}
		case 3:{
			rg_mentality_2.check(2);
			rb_mentality_2_3.setChecked(true);
			break;
		}
		}
		it = diabet2.getDise_comply();
		switch(it){
		case 1:{
			rg_comply_2.check(0);
			rb_comply_2_1.setChecked(true);
			break;
		}
		case 2:{
			rg_comply_2.check(1);
			rb_comply_2_2.setChecked(true);
			break;
		}
		case 3:{
			rg_comply_2.check(2);
			rb_comply_2_3.setChecked(true);
			break;
		}
		}
		
		//第三次随访记录
		temp = diabet3.getDise_date();
		if(temp.length()>0){
			et_date_3.setText(temp);
		}
		it = diabet3.getDise_service_pattern();
		switch(it){
		case 1:{
			rg_service_pattern_3.check(0);
			rb_service_pattern_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_service_pattern_3.check(1);
			rb_service_pattern_3_2.setChecked(true);
			break;
		}
		case 3:{
			rg_service_pattern_3.check(2);
			rb_service_pattern_3_3.setChecked(true);
			break;
		}
		}
		
		temp = diabet3.getDise_symptoms();
		if(temp.length()>0){
			et_symptoms_3.setText(temp);
		}
		temp = diabet3.getDise_symptom_other();
		if(temp.length()>0){
			et_symptom_other_3.setText(temp);
		}
		it = diabet3.getDise_blood_pressure_high();
		if(it!=-1){
			et_blood_pressure_high_3.setText(String.valueOf(it));
		}
		it = diabet3.getDise_blood_pressure_low();
		if(it!=-1){
			et_blood_pressure_low_3.setText(String.valueOf(it));
		}
		ft = diabet3.getDise_weight_now();
		if(ft!=-1f){
			et_weight_now_3.setText(String.valueOf(ft));
		}
		ft = diabet3.getDise_weight_goal();
		if(ft!=-1f){
			et_weight_goal_3.setText(String.valueOf(ft));
		}
		ft = diabet3.getDise_bmt_now();
		if(ft!=-1f){
			et_bmt_now_3.setText(String.valueOf(ft));
		}
		ft = diabet3.getDise_bmt_goal();
		if(ft!=-1f){
			et_bmt_goal_3.setText(String.valueOf(ft));
		}
		it = diabet3.getDise_dap();
		switch(it){
		case 1:{
			rg_dap_3.check(0);
			rb_dap_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_dap_3.check(1);
			rb_dap_3_2.setChecked(true);
			break;
		}
		}
		temp = diabet3.getDise_physical_sign_other();
		if(temp.length()>0){
			et_physical_sign_other_3.setText(temp);
		}
		it = diabet3.getDise_smoke_now();
		if(it!=-1){
			et_smoke_now_3.setText(String.valueOf(it));
		}
		it = diabet3.getDise_smoke_goal();
		if(it!=-1){
			et_smoke_goal_3.setText(String.valueOf(it));
		}
		ft = diabet3.getDise_drink_now();
		if(ft!=-1f){
			et_drink_now_3.setText(String.valueOf(ft));
		}
		ft = diabet3.getDise_drink_goal();
		if(ft!=-1f){
			et_drink_goal_3.setText(String.valueOf(ft));
		}
		it = diabet3.getDise_exe_per_week_now();
		if(it!=-1){
			et_exe_per_week_now_3.setText(String.valueOf(it));
		}
		it = diabet3.getDise_exe_per_week_goal();
		if(it!=-1){
			et_exe_per_week_goal_3.setText(String.valueOf(it));
		}
		it = diabet3.getDise_exe_lastlong_now();
		if(it!=-1){
			et_exe_lastlong_now_3.setText(String.valueOf(it));
		}
		it = diabet3.getDise_exe_lastlong_goal();
		if(it!=-1){
			et_exe_lastlong_goal_3.setText(String.valueOf(it));
		}
		ft = diabet3.getDise_diet_now();
		if(ft!=-1f){
			et_diet_now_3.setText(String.valueOf(ft));
		}
		ft = diabet3.getDise_diet_goal();
		if(ft!=-1f){
			et_diet_goal_3.setText(String.valueOf(ft));
		}
		it = diabet3.getDise_mentality();
		switch(it){
		case 1:{
			rg_mentality_3.check(0);
			rb_mentality_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_mentality_3.check(1);
			rb_mentality_3_2.setChecked(true);
			break;
		}
		case 3:{
			rg_mentality_3.check(2);
			rb_mentality_3_3.setChecked(true);
			break;
		}
		}
		it = diabet3.getDise_comply();
		switch(it){
		case 1:{
			rg_comply_3.check(0);
			rb_comply_3_1.setChecked(true);
			break;
		}
		case 2:{
			rg_comply_3.check(1);
			rb_comply_3_2.setChecked(true);
			break;
		}
		case 3:{
			rg_comply_3.check(2);
			rb_comply_3_3.setChecked(true);
			break;
		}
		}
		
		//第四次随访记录
		temp = diabet4.getDise_date();
		if(temp.length()>0){
			et_date_4.setText(temp);
		}
		it = diabet4.getDise_service_pattern();
		switch(it){
		case 1:{
			rg_service_pattern_4.check(0);
			rb_service_pattern_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_service_pattern_4.check(1);
			rb_service_pattern_4_2.setChecked(true);
			break;
		}
		case 3:{
			rg_service_pattern_4.check(2);
			rb_service_pattern_4_3.setChecked(true);
			break;
		}
		}
		
		temp = diabet4.getDise_symptoms();
		if(temp.length()>0){
			et_symptoms_4.setText(temp);
		}
		temp = diabet4.getDise_symptom_other();
		if(temp.length()>0){
			et_symptom_other_4.setText(temp);
		}
		it = diabet4.getDise_blood_pressure_high();
		if(it!=-1){
			et_blood_pressure_high_4.setText(String.valueOf(it));
		}
		it = diabet4.getDise_blood_pressure_low();
		if(it!=-1){
			et_blood_pressure_low_4.setText(String.valueOf(it));
		}
		ft = diabet4.getDise_weight_now();
		if(ft!=-1f){
			et_weight_now_4.setText(String.valueOf(ft));
		}
		ft = diabet4.getDise_weight_goal();
		if(ft!=-1f){
			et_weight_goal_4.setText(String.valueOf(ft));
		}
		ft = diabet4.getDise_bmt_now();
		if(ft!=-1f){
			et_bmt_now_4.setText(String.valueOf(ft));
		}
		ft = diabet4.getDise_bmt_goal();
		if(ft!=-1f){
			et_bmt_goal_4.setText(String.valueOf(ft));
		}
		it = diabet4.getDise_dap();
		switch(it){
		case 1:{
			rg_dap_4.check(0);
			rb_dap_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_dap_4.check(1);
			rb_dap_4_2.setChecked(true);
			break;
		}
		}
		temp = diabet4.getDise_physical_sign_other();
		if(temp.length()>0){
			et_physical_sign_other_4.setText(temp);
		}
		it = diabet4.getDise_smoke_now();
		if(it!=-1){
			et_smoke_now_4.setText(String.valueOf(it));
		}
		it = diabet4.getDise_smoke_goal();
		if(it!=-1){
			et_smoke_goal_4.setText(String.valueOf(it));
		}
		ft = diabet4.getDise_drink_now();
		if(ft!=-1f){
			et_drink_now_4.setText(String.valueOf(ft));
		}
		ft = diabet4.getDise_drink_goal();
		if(ft!=-1f){
			et_drink_goal_4.setText(String.valueOf(ft));
		}
		it = diabet4.getDise_exe_per_week_now();
		if(it!=-1){
			et_exe_per_week_now_4.setText(String.valueOf(it));
		}
		it = diabet4.getDise_exe_per_week_goal();
		if(it!=-1){
			et_exe_per_week_goal_4.setText(String.valueOf(it));
		}
		it = diabet4.getDise_exe_lastlong_now();
		if(it!=-1){
			et_exe_lastlong_now_4.setText(String.valueOf(it));
		}
		it = diabet4.getDise_exe_lastlong_goal();
		if(it!=-1){
			et_exe_lastlong_goal_4.setText(String.valueOf(it));
		}
		ft = diabet4.getDise_diet_now();
		if(ft!=-1f){
			et_diet_now_4.setText(String.valueOf(ft));
		}
		ft = diabet4.getDise_diet_goal();
		if(ft!=-1f){
			et_diet_goal_4.setText(String.valueOf(ft));
		}
		it = diabet4.getDise_mentality();
		switch(it){
		case 1:{
			rg_mentality_4.check(0);
			rb_mentality_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_mentality_4.check(1);
			rb_mentality_4_2.setChecked(true);
			break;
		}
		case 3:{
			rg_mentality_4.check(2);
			rb_mentality_4_3.setChecked(true);
			break;
		}
		}
		it = diabet4.getDise_comply();
		switch(it){
		case 1:{
			rg_comply_4.check(0);
			rb_comply_4_1.setChecked(true);
			break;
		}
		case 2:{
			rg_comply_4.check(1);
			rb_comply_4_2.setChecked(true);
			break;
		}
		case 3:{
			rg_comply_4.check(2);
			rb_comply_4_3.setChecked(true);
			break;
		}
		}
		
	}
	
	/**
	 * 初始时状态：横线为空，所有选择项未选中
	 */
	private void initialState() {
		et_name.setText("");
		et_id.setText("");
		et_date_1.setText("");
		et_date_2.setText("");
		et_date_3.setText("");
		et_date_4.setText("");
		et_symptoms_1.setText("");
		et_symptoms_2.setText("");
		et_symptoms_3.setText("");
		et_symptoms_4.setText("");
		et_symptom_other_1.setText("");
		et_symptom_other_2.setText("");
		et_symptom_other_3.setText("");
		et_symptom_other_4.setText("");
		et_blood_pressure_high_1.setText("");
		et_blood_pressure_high_2.setText("");
		et_blood_pressure_high_3.setText("");
		et_blood_pressure_high_4.setText("");
		et_blood_pressure_low_1.setText("");
		et_blood_pressure_low_2.setText("");
		et_blood_pressure_low_3.setText("");
		et_blood_pressure_low_4.setText("");
		et_weight_now_1.setText("");
		et_weight_now_2.setText("");
		et_weight_now_3.setText("");
		et_weight_now_4.setText("");
		et_weight_goal_1.setText("");
		et_weight_goal_2.setText("");
		et_weight_goal_3.setText("");
		et_weight_goal_4.setText("");
		et_bmt_now_1.setText("");
		et_bmt_now_2.setText("");
		et_bmt_now_3.setText("");
		et_bmt_now_4.setText("");
		et_bmt_goal_1.setText("");
		et_bmt_goal_2.setText("");
		et_bmt_goal_3.setText("");
		et_bmt_goal_4.setText("");
		et_physical_sign_other_1.setText("");
		et_physical_sign_other_2.setText("");
		et_physical_sign_other_3.setText("");
		et_physical_sign_other_4.setText("");
		et_smoke_now_1.setText("");
		et_smoke_now_2.setText("");
		et_smoke_now_3.setText("");
		et_smoke_now_4.setText("");
		et_smoke_goal_1.setText("");
		et_smoke_goal_2.setText("");
		et_smoke_goal_3.setText("");
		et_smoke_goal_4.setText("");
		et_drink_now_1.setText("");
		et_drink_now_2.setText("");
		et_drink_now_3.setText("");
		et_drink_now_4.setText("");
		et_drink_goal_1.setText("");
		et_drink_goal_2.setText("");
		et_drink_goal_3.setText("");
		et_drink_goal_4.setText("");
		et_exe_per_week_now_1.setText("");
		et_exe_per_week_now_2.setText("");
		et_exe_per_week_now_3.setText("");
		et_exe_per_week_now_4.setText("");
		et_exe_per_week_goal_1.setText("");
		et_exe_per_week_goal_2.setText("");
		et_exe_per_week_goal_3.setText("");
		et_exe_per_week_goal_4.setText("");
		et_exe_lastlong_now_1.setText("");
		et_exe_lastlong_now_2.setText("");
		et_exe_lastlong_now_3.setText("");
		et_exe_lastlong_now_4.setText("");
		et_exe_lastlong_goal_1.setText("");
		et_exe_lastlong_goal_2.setText("");
		et_exe_lastlong_goal_3.setText("");
		et_exe_lastlong_goal_4.setText("");
		et_diet_now_1.setText("");
		et_diet_now_2.setText("");
		et_diet_now_3.setText("");
		et_diet_now_4.setText("");
		et_diet_goal_1.setText("");
		et_diet_goal_2.setText("");
		et_diet_goal_3.setText("");
		et_diet_goal_4.setText("");
		rb_service_pattern_1_1.setChecked(false);
		rb_service_pattern_1_2.setChecked(false);
		rb_service_pattern_1_3.setChecked(false);
		rb_service_pattern_2_1.setChecked(false);
		rb_service_pattern_2_2.setChecked(false);
		rb_service_pattern_2_3.setChecked(false);
		rb_service_pattern_3_1.setChecked(false);
		rb_service_pattern_3_2.setChecked(false);
		rb_service_pattern_3_3.setChecked(false);
		rb_service_pattern_4_1.setChecked(false);
		rb_service_pattern_4_2.setChecked(false);
		rb_service_pattern_4_3.setChecked(false);
		rb_dap_1_1.setChecked(false);
		rb_dap_1_2.setChecked(false);
		rb_dap_2_1.setChecked(false);
		rb_dap_2_2.setChecked(false);
		rb_dap_3_1.setChecked(false);
		rb_dap_3_2.setChecked(false);
		rb_dap_4_1.setChecked(false);
		rb_dap_4_2.setChecked(false);
		rb_mentality_1_1.setChecked(false);
		rb_mentality_1_2.setChecked(false);
		rb_mentality_1_3.setChecked(false);
		rb_mentality_2_1.setChecked(false);
		rb_mentality_2_2.setChecked(false);
		rb_mentality_2_3.setChecked(false);
		rb_mentality_3_1.setChecked(false);
		rb_mentality_3_2.setChecked(false);
		rb_mentality_3_3.setChecked(false);
		rb_mentality_4_1.setChecked(false);
		rb_mentality_4_2.setChecked(false);
		rb_mentality_4_3.setChecked(false);
		rb_comply_1_1.setChecked(false);
		rb_comply_1_2.setChecked(false);
		rb_comply_1_3.setChecked(false);
		rb_comply_2_1.setChecked(false);
		rb_comply_2_2.setChecked(false);
		rb_comply_2_3.setChecked(false);
		rb_comply_3_1.setChecked(false);
		rb_comply_3_2.setChecked(false);
		rb_comply_3_3.setChecked(false);
		rb_comply_4_1.setChecked(false);
		rb_comply_4_2.setChecked(false);
		rb_comply_4_3.setChecked(false);
	}
	
	/**
	 * 从数据库中检出数据
	 */
	public void fetchData(){
		ht = new HereTipa(mContext);
		ht.selectNameAndCode(profileId);
		
		diabet1 = new DiabetService(mContext);
		diabet1.selectDiabetService(profileId, 1);
		diabet2 = new DiabetService(mContext);
		diabet2.selectDiabetService(profileId, 2);
		diabet3 = new DiabetService(mContext);
		diabet3.selectDiabetService(profileId, 3);
		diabet4 = new DiabetService(mContext);
		diabet4.selectDiabetService(profileId, 4);
	}
	
	/**
	 * 将view添加到父view中
	 */
	public void setMyView(){
		this.removeAllViews();
		LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		this.addView(child,lp);
	}
	
	/**
	 * 将整个界面作为一个view对象
	 * @return 整个界面view
	 */
	public View getMyView(){
		return child;
	}
	
	/**
	 * 保存views的值到数据库
	 */
	public void saveViews() {
		String temp = "";
		
		//第一次随访记录
		DiabetService ds1 = new DiabetService(mContext);
		ds1.selectDiabetService(profileId, 1);
		
		temp = et_date_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_date(temp);
		}
		if(rb_service_pattern_1_1.isChecked()==true){
			ds1.setDise_service_pattern(1);
		}
		else if(rb_service_pattern_1_2.isChecked()==true){
			ds1.setDise_service_pattern(2);
		}else if(rb_service_pattern_1_3.isChecked()==true){
			ds1.setDise_service_pattern(3);
		}
		temp = et_symptoms_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_symptoms(temp);
		}
		temp = et_symptom_other_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_symptom_other(temp);
		}
		temp = et_blood_pressure_high_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_blood_pressure_high(Integer.parseInt(temp));
		}
		temp = et_blood_pressure_low_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_blood_pressure_low(Integer.parseInt(temp));
		}
		temp = et_weight_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_weight_now(Float.parseFloat(temp));
		}
		temp = et_weight_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_weight_goal(Float.parseFloat(temp));
		}
		temp = et_bmt_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_bmt_now(Float.parseFloat(temp));
		}
		temp = et_bmt_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_bmt_goal(Float.parseFloat(temp));
		}
		if(rb_dap_1_1.isChecked()==true){
			ds1.setDise_dap(1);
		}else if(rb_dap_1_2.isChecked()==true){
			ds1.setDise_dap(2);
		}
		temp = et_physical_sign_other_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_physical_sign_other(temp);
		}
		temp = et_smoke_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_smoke_now(Integer.valueOf(temp));
		}
		temp = et_smoke_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_smoke_goal(Integer.valueOf(temp));
		}
		temp = et_drink_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_drink_now(Float.parseFloat(temp));
		}
		temp = et_drink_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_drink_goal(Float.parseFloat(temp));
		}
		temp = et_exe_per_week_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_exe_per_week_now(Integer.valueOf(temp));
		}
		temp = et_exe_per_week_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_exe_per_week_goal(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_exe_lastlong_now(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_exe_lastlong_goal(Integer.valueOf(temp));
		}
		temp = et_diet_now_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_diet_now(Float.parseFloat(temp));
		}
		temp = et_diet_goal_1.getText().toString();
		if(temp.length()>0){
			ds1.setDise_diet_goal(Float.parseFloat(temp));
		}
		if(rb_mentality_1_1.isChecked()==true){
			ds1.setDise_mentality(1);
		}else if(rb_mentality_1_2.isChecked()==true){
			ds1.setDise_mentality(2);
		}else if(rb_mentality_1_3.isChecked()==true){
			ds1.setDise_mentality(3);
		}
		if(rb_comply_1_1.isChecked()==true){
			ds1.setDise_comply(1);
		}else if(rb_comply_1_2.isChecked()==true){
			ds1.setDise_comply(2);
		}else if(rb_comply_1_3.isChecked()==true){
			ds1.setDise_comply(3);
		}
		
		ds1.updateDiabetService(profileId, 1);
		
		//第二次随访记录
		DiabetService ds2 = new DiabetService(mContext);
		ds2.selectDiabetService(profileId, 2);

		temp = et_date_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_date(temp);
		}
		if(rb_service_pattern_2_1.isChecked()==true){
			ds2.setDise_service_pattern(1);
		}else if(rb_service_pattern_2_2.isChecked()==true){
			ds2.setDise_service_pattern(2);
		}else if(rb_service_pattern_2_3.isChecked()==true){
			ds2.setDise_service_pattern(3);
		}
		temp = et_symptoms_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_symptoms(temp);
		}
		temp = et_symptom_other_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_symptom_other(temp);
		}
		temp = et_blood_pressure_high_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_blood_pressure_high(Integer.parseInt(temp));
		}
		temp = et_blood_pressure_low_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_blood_pressure_low(Integer.parseInt(temp));
		}
		temp = et_weight_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_weight_now(Float.parseFloat(temp));
		}
		temp = et_weight_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_weight_goal(Float.parseFloat(temp));
		}
		temp = et_bmt_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_bmt_now(Float.parseFloat(temp));
		}
		temp = et_bmt_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_bmt_goal(Float.parseFloat(temp));
		}
		if(rb_dap_2_1.isChecked()==true){
			ds2.setDise_dap(1);
		}else if(rb_dap_2_2.isChecked()==true){
			ds2.setDise_dap(2);
		}
		temp = et_physical_sign_other_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_physical_sign_other(temp);
		}
		temp = et_smoke_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_smoke_now(Integer.valueOf(temp));
		}
		temp = et_smoke_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_smoke_goal(Integer.valueOf(temp));
		}
		temp = et_drink_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_drink_now(Float.parseFloat(temp));
		}
		temp = et_drink_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_drink_goal(Float.parseFloat(temp));
		}
		temp = et_exe_per_week_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_exe_per_week_now(Integer.valueOf(temp));
		}
		temp = et_exe_per_week_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_exe_per_week_goal(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_exe_lastlong_now(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_exe_lastlong_goal(Integer.valueOf(temp));
		}
		temp = et_diet_now_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_diet_now(Float.parseFloat(temp));
		}
		temp = et_diet_goal_2.getText().toString();
		if(temp.length()>0){
			ds2.setDise_diet_goal(Float.parseFloat(temp));
		}
		if(rb_mentality_2_1.isChecked()==true){
			ds2.setDise_mentality(1);
		}else if(rb_mentality_2_2.isChecked()==true){
			ds2.setDise_mentality(2);
		}else if(rb_mentality_2_3.isChecked()==true){
			ds2.setDise_mentality(3);
		}
		if(rb_comply_2_1.isChecked()==true){
			ds2.setDise_comply(1);
		}else if(rb_comply_2_2.isChecked()==true){
			ds2.setDise_comply(2);
		}else if(rb_comply_2_3.isChecked()==true){
			ds2.setDise_comply(3);
		}
		
		ds2.updateDiabetService(profileId, 2);
		
		//第三次随访记录
		DiabetService ds3 = new DiabetService(mContext);
		ds3.selectDiabetService(profileId, 3);

		temp = et_date_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_date(temp);
		}
		if(rb_service_pattern_3_1.isChecked()==true){
			ds3.setDise_service_pattern(1);
		}else if(rb_service_pattern_3_2.isChecked()==true){
			ds3.setDise_service_pattern(2);
		}else if(rb_service_pattern_3_3.isChecked()==true){
			ds3.setDise_service_pattern(3);
		}
		temp = et_symptoms_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_symptoms(temp);
		}
		temp = et_symptom_other_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_symptom_other(temp);
		}
		temp = et_blood_pressure_high_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_blood_pressure_high(Integer.parseInt(temp));
		}
		temp = et_blood_pressure_low_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_blood_pressure_low(Integer.parseInt(temp));
		}
		temp = et_weight_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_weight_now(Float.parseFloat(temp));
		}
		temp = et_weight_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_weight_goal(Float.parseFloat(temp));
		}
		temp = et_bmt_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_bmt_now(Float.parseFloat(temp));
		}
		temp = et_bmt_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_bmt_goal(Float.parseFloat(temp));
		}
		if(rb_dap_3_1.isChecked()==true){
			ds3.setDise_dap(1);
		}else if(rb_dap_3_2.isChecked()==true){
			ds3.setDise_dap(2);
		}
		temp = et_physical_sign_other_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_physical_sign_other(temp);
		}
		temp = et_smoke_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_smoke_now(Integer.valueOf(temp));
		}
		temp = et_smoke_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_smoke_goal(Integer.valueOf(temp));
		}
		temp = et_drink_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_drink_now(Float.parseFloat(temp));
		}
		temp = et_drink_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_drink_goal(Float.parseFloat(temp));
		}
		temp = et_exe_per_week_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_exe_per_week_now(Integer.valueOf(temp));
		}
		temp = et_exe_per_week_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_exe_per_week_goal(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_exe_lastlong_now(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_exe_lastlong_goal(Integer.valueOf(temp));
		}
		temp = et_diet_now_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_diet_now(Float.parseFloat(temp));
		}
		temp = et_diet_goal_3.getText().toString();
		if(temp.length()>0){
			ds3.setDise_diet_goal(Float.parseFloat(temp));
		}
		if(rb_mentality_3_1.isChecked()==true){
			ds3.setDise_mentality(1);
		}else if(rb_mentality_3_2.isChecked()==true){
			ds3.setDise_mentality(2);
		}else if(rb_mentality_3_3.isChecked()==true){
			ds3.setDise_mentality(3);
		}
		if(rb_comply_3_1.isChecked()==true){
			ds3.setDise_comply(1);
		}else if(rb_comply_3_2.isChecked()==true){
			ds3.setDise_comply(2);
		}else if(rb_comply_3_3.isChecked()==true){
			ds3.setDise_comply(3);
		}
		
		ds3.updateDiabetService(profileId, 3);
		
		//第四次随访记录
		DiabetService ds4 = new DiabetService(mContext);
		ds4.selectDiabetService(profileId, 4);

		temp = et_date_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_date(temp);
		}
		if(rb_service_pattern_4_1.isChecked()==true){
			ds4.setDise_service_pattern(1);
		}
		else if(rb_service_pattern_4_2.isChecked()==true){
			ds4.setDise_service_pattern(2);
		}else if(rb_service_pattern_4_3.isChecked()==true){
			ds4.setDise_service_pattern(3);
		}
		temp = et_symptoms_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_symptoms(temp);
		}
		temp = et_symptom_other_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_symptom_other(temp);
		}
		temp = et_blood_pressure_high_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_blood_pressure_high(Integer.parseInt(temp));
		}
		temp = et_blood_pressure_low_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_blood_pressure_low(Integer.parseInt(temp));
		}
		temp = et_weight_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_weight_now(Float.parseFloat(temp));
		}
		temp = et_weight_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_weight_goal(Float.parseFloat(temp));
		}
		temp = et_bmt_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_bmt_now(Float.parseFloat(temp));
		}
		temp = et_bmt_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_bmt_goal(Float.parseFloat(temp));
		}
		if(rb_dap_4_1.isChecked()==true){
			ds4.setDise_dap(1);
		}else if(rb_dap_4_2.isChecked()==true){
			ds4.setDise_dap(2);
		}
		temp = et_physical_sign_other_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_physical_sign_other(temp);
		}
		temp = et_smoke_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_smoke_now(Integer.valueOf(temp));
		}
		temp = et_smoke_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_smoke_goal(Integer.valueOf(temp));
		}
		temp = et_drink_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_drink_now(Float.parseFloat(temp));
		}
		temp = et_drink_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_drink_goal(Float.parseFloat(temp));
		}
		temp = et_exe_per_week_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_exe_per_week_now(Integer.valueOf(temp));
		}
		temp = et_exe_per_week_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_exe_per_week_goal(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_exe_lastlong_now(Integer.valueOf(temp));
		}
		temp = et_exe_lastlong_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_exe_lastlong_goal(Integer.valueOf(temp));
		}
		temp = et_diet_now_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_diet_now(Float.parseFloat(temp));
		}
		temp = et_diet_goal_4.getText().toString();
		if(temp.length()>0){
			ds4.setDise_diet_goal(Float.parseFloat(temp));
		}
		if(rb_mentality_4_1.isChecked()==true){
			ds4.setDise_mentality(1);
		}else if(rb_mentality_4_2.isChecked()==true){
			ds4.setDise_mentality(2);
		}else if(rb_mentality_4_3.isChecked()==true){
			ds4.setDise_mentality(3);
		}
		if(rb_comply_4_1.isChecked()==true){
			ds4.setDise_comply(1);
		}else if(rb_comply_4_2.isChecked()==true){
			ds4.setDise_comply(2);
		}else if(rb_comply_4_3.isChecked()==true){
			ds4.setDise_comply(3);
		}
		
		ds4.updateDiabetService(profileId, 4);
	}

	@Override
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==et_symptoms_1){
			SymptomDialog().show();
		}

	}
	
	/**
	 * 显示症状选择的对话框（多选）
	 */
	private Dialog SymptomDialog(){
		return new AlertDialog.Builder(mContext)
		.setTitle("")
		.setMultiChoiceItems(R.array.diabet_symptoms, null, new OnMultiChoiceClickListener(){

			@Override
			public void onClick(DialogInterface dialog, int which, boolean isChecked) {
				// TODO Auto-generated method stub
				
			}
			
		})
		.create();
	}
	
	/**
	 * 显示时间控件
	 * @param view 时间控件的触发控件
	 * @param viewid 触发控件的资源ID
	 */
	private void showTimeWidget(View view, int viewid){
		
	}

}
